//
// Created by fanghr on 17-12-28.
//

#ifndef PROJECT_IMU_REQ_PACK_H
#define PROJECT_IMU_REQ_PACK_H

#include "../include.h"

class imu_req_pack {
public:
    struct table_t {
        friend class boost::serialization::access;

        bool with_imu_time,
                with_imu_acceleration,
                with_imu_angularVelocity,
                with_imu_angle,
                with_imu_magneticOutput,
                with_imu_portStatus,
                with_imu_pressureAndHeightOutput,
                with_imu_latitudeAndLongitudeOutput,
                with_imu_groundSpeed,
                with_imu_quaternion,
                with_imu_frame;

        template<class Archive>
        void serialize(Archive &ar, const unsigned int) {
            ar & with_imu_time &
            with_imu_acceleration &
            with_imu_angularVelocity &
            with_imu_angle &
            with_imu_magneticOutput &
            with_imu_portStatus &
            with_imu_pressureAndHeightOutput &
            with_imu_latitudeAndLongitudeOutput &
            with_imu_groundSpeed &
            with_imu_quaternion &
            with_imu_frame;
        }
    };

private:
    table_t table;

    friend class boost::serialization::access;

    template<class Archive>
    void serialize(Archive &ar, const unsigned int) {
        ar & table;
    }

public:
    imu_req_pack() {}

    imu_req_pack(bool with_imu_time,
                 bool with_imu_acceleration,
                 bool with_imu_angularVelocity,
                 bool with_imu_angle,
                 bool with_imu_magneticOutput,
                 bool with_imu_portStatus,
                 bool with_imu_pressureAndHeightOutput,
                 bool with_imu_latitudeAndLongitudeOutput,
                 bool with_imu_groundSpeed,
                 bool with_imu_quaternion,
                 bool with_imu_frame) {
        table.with_imu_time = with_imu_time;
        table.with_imu_acceleration = with_imu_acceleration;
        table.with_imu_angularVelocity = with_imu_angularVelocity;
        table.with_imu_angle = with_imu_angle;
        table.with_imu_magneticOutput = with_imu_magneticOutput;
        table.with_imu_portStatus = with_imu_portStatus;
        table.with_imu_pressureAndHeightOutput = with_imu_pressureAndHeightOutput;
        table.with_imu_latitudeAndLongitudeOutput = with_imu_latitudeAndLongitudeOutput;
        table.with_imu_groundSpeed = with_imu_groundSpeed;
        table.with_imu_quaternion = with_imu_quaternion;
        table.with_imu_frame = with_imu_frame;
    }

    table_t get() {
        return table;
    }
};

#endif //PROJECT_IMU_REQ_PACK_H
